package com.example.demo.controller;

import com.xiaohei.crm.common.result.Result;
import com.xiaohei.crm.common.result.ResultCodeEnum;
import com.xiaohei.crm.dao.vo.ValidateCodeVo;
import com.xiaohei.crm.service.ValidateCodeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@CrossOrigin
@RequiredArgsConstructor
@Slf4j
public class ValidateController {

    private final ValidateCodeService validateCodeService;
    /**
     * 生成图片验证码
     * @return
     */
    @GetMapping(value = "/generateValidateCode")
    public Result<ValidateCodeVo> generateValidateCode(){
        log.info("Generating Validate");
        ValidateCodeVo validateCodeVo = validateCodeService.generateValidateCode();
        return Result.build(validateCodeVo, ResultCodeEnum.SUCCESS);
    }

}
